﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Assisticant.Fields;
using UGD.Models;

namespace UGD.ViewModels
{
    public class ItemViewModel
    {
        private readonly Item _item;
        private readonly decimal _totalTicksInRange;


        public ItemViewModel(Item item, decimal TotalTicksInRange)
        {
            _item = item;
            _totalTicksInRange = TotalTicksInRange;
        }

        public string Name
        {
            get
            {
                return _item.Name;
            }
            set
            {
                _item.Name = value;
            }
        }

        public decimal Ticks => (decimal)_item.Ticks / _totalTicksInRange;

        public bool ShowChart
        {
            get { return _item.ShowChart; }
            set { _item.ShowChart = value; }
        }


        public IEnumerable<DutyViewModel> Duty
       => from item in _item.Duty select new DutyViewModel(item);


    }
}
